<template>
  <Header></Header>
  <Drawer></Drawer>
  <el-breadcrumb separator="/" style="font-size: 20px;color: #2AB28B;">
    <el-breadcrumb-item :to="{ path: '/Home' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item :to="{ path: '/Home' }">{{ labName }}</el-breadcrumb-item>
    <el-breadcrumb-item :to="{ path: '/CompanyList/'+ groupId }">档案管理</el-breadcrumb-item>
    <el-breadcrumb-item>机关单位</el-breadcrumb-item>
  </el-breadcrumb>

    <div class = 'pageListBotton'>
      <el-button :icon="Expand" color="#626aef" style="color: white" round @click="pageList">
        机关列表
      </el-button>
      <span class="onBtnRight"  @click="onHome"><img src="../assets/img/pageList_qiehuan.png" alt=""> 更换群体</span>
  </div>

  <CompanyLeft></CompanyLeft>
  <el-card class="right-box-card">
    <CompanyChildDiet></CompanyChildDiet>
  </el-card>

</template>

<script setup>
import { Edit, CirclePlus, Search, Expand,  } from '@element-plus/icons-vue'
import {defineComponent, onMounted, ref, watch} from 'vue';
import {ElMessage} from "element-plus";
import * as api from "../api/loginHttp";
import Header from './common/Header.vue';
import Drawer from './common/Drawer.vue';
import CompanyLeft from './common/CompanyLeft.vue';
import CompanyChildDiet from './common/CompanyChilddiet.vue';
import http, {baseUrl} from "../utils/http";
import {useRoute, useRouter} from "vue-router"
const route = useRoute()
const router = useRouter()
const groupId = ref()
const labName = ref()
const id = ref()

const fetchData = async (isReset, addTo = 0, Botton = 0) => {
  if (route.params.groupId) {
    groupId.value = route.params.groupId
    id.value = route.params.id
    if(groupId.value == 3) {
      labName.value = '婴幼儿营养测评'
    } else if(groupId.value == 5) {
      labName.value = '孕产妇营养测评'
    } else if(groupId.value == 6) {
      labName.value = '成年人营养测评'
    } else if(groupId.value == 7) {
      labName.value = '慢性病营养测评'
    } else if (groupId.value == 8) {
      labName.value = '团体营养测评'
    } else {
      labName.value = '婴幼儿营养测评'
    }
  } else {
    ElMessage.error('栏目编号不得为空')
    await router.push({'path': '/Home'})
  }

}

const onHome = async () => {
  await router.push({'path': '/Home'})
}

const pageList = async () => {
  await router.push({'path': '/CompanyList/' + groupId.value})
}


onMounted(() => {
  fetchData()
})
</script>

<style scoped>

</style>
